Skip to content

Fix PHP8.5 deprecation warnings with ReflectionProperty::setAccessible() #4230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2025

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Aug 10, 2025

fixes test errors:

PHPUnit 9.6.23 by Sebastian Bergmann and contributors.

Warning:       No code coverage driver available

PHP Deprecated:  Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect in phar:///home/runner/work/phpstan-src/phpstan-src/extension/vendor/phpstan/phpstan/phpstan.phar/src/Testing/TestCaseSourceLocatorFactory.php on line 73
...R
Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect in phar:///home/runner/work/phpstan-src/phpstan-src/extension/vendor/phpstan/phpstan/phpstan.phar/src/Testing/TestCaseSourceLocatorFactory.php on line 73
.....................................................         57 / 57 (100%)

Time: 00:52.874, Memory: 110.00 MB

There was 1 risky test:

1) PHPStan\Rules\BooleansInConditions\BooleanInBooleanAndRuleTest::testRule
Test code or tested code printed unexpected output: 
Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect in phar:///home/runner/work/phpstan-src/phpstan-src/extension/vendor/phpstan/phpstan/phpstan.phar/src/Testing/TestCaseSourceLocatorFactory.php on line 73

setAccessible is a no-op since 8.1 - see https://wiki.php.net/rfc/make-reflection-setaccessible-no-op

@staabm staabm marked this pull request as ready for review August 10, 2025 09:41
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes ondrejmirtes merged commit 466a3de into phpstan:2.1.x Aug 10, 2025
451 of 455 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the fix85 branch August 10, 2025 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants